//
//  ViewController.m
//  30301
//
//  Created by student on 16/3/18.
//  Copyright © 2016年 NIIT. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *imageview;
@property (nonatomic,weak) CALayer *layer;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.imageview.layer.cornerRadius=50;
    self.imageview.layer.borderColor=[UIColor yellowColor].CGColor;
    self.imageview.layer.borderWidth=10;
    self.imageview.layer.masksToBounds=YES;
    self.imageview.layer.shadowColor=[UIColor greenColor].CGColor;
    self.imageview.layer.shadowOffset=CGSizeMake(10, 10);
    self.imageview.layer.shadowOpacity=0.5f;
    self.imageview.layer.shadowRadius=10;
    
    
    
    CALayer *layer=[CALayer layer];
    layer.frame=CGRectMake(100, 230, 100, 100);
    layer.cornerRadius=20;
    layer.masksToBounds=YES;
//    layer.contents=(id)[UIImage imageNamed:@"2"].CGImage;
    [self.view.layer addSublayer:layer];
    self.layer=layer;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
//    CGSize winsize=[UIScreen mainScreen].bounds.size;
//    self.layer.position=CGPointMake(arc4random_uniform(winsize.width), arc4random_uniform(winsize.height));
//    self.layer.cornerRadius=arc4random_uniform(1);
//    self.layer.backgroundColor=[UIColor colorWithRed:arc4random_uniform(255)/255.0 green:arc4random_uniform(255)/255.0 blue:arc4random_uniform(255)/255.0 alpha:1].CGColor;
//    self.layer.borderColor=[UIColor colorWithRed:arc4random_uniform(255)/255.0 green:arc4random_uniform(255)/255.0 blue:arc4random_uniform(255)/255.0 alpha:arc4random_uniform(255)/255.0].CGColor;
//    
//    self.layer.borderWidth=arc4random_uniform(1);
//    self.layer.transform=CATransform3DMakeRotation(arc4random_uniform(M_PI*2), 1,0,0);
//    [UIView commitAnimations];
    
    
}
@end
